package cn.netjava.chapter6;

import java.io.*;


public class CopyFile {
	public boolean cp(String src,String dest)throws Exception
	{
		InputStream ins = new FileInputStream(src);
		OutputStream ous = new FileOutputStream(dest);
		byte[] b = new byte[ins.available()];
		ins.read(b);
		ous.write(b);
		ous.flush();
		ins.close();
		ous.close();
		
	return true;
	}
	
	public static void main(String[] args)throws Exception{
		CopyFile cf = new CopyFile();
		long start = System.currentTimeMillis();
		cf.cp("CopyFile.java","bakFile.java");
		System.out.println(System.currentTimeMillis()-start);
	}
	

}
